import request from '@/utils/request.js'

//领导信箱相关接口封装

//领导信箱
export const writeLetterService = (DataObj)=>{
    return request.post('/consulting/writeLetter',DataObj);
}

//获取所有领导回信
export const getAllReplyService =(DataObj)=>{
    return request.get(`/consulting/${DataObj}/getleaderAllReply`)
}
//获取领导回信
export const getLaederReplyService = (DataObj)=>{
    return request.get(`/consulting/getleaderReply&userId=${DataObj.userId}&mailBoxId=${DataObj.mailboxid}`);
}

//获取用户发送的信件
export const getAllLetterService=(userId)=>{
    const url = `/consulting/${userId.userId}/getleaderAllReply`;
    return request.get(url);
}

//获取某一具体信件
export const getOneLetterService = (DataObj)=>{
    return request.get(`/consulting/getleaderMail/${DataObj.mailboxid}`);
}

//用户接访功能接口封装

//查询用户所有的上访记录
export const getAllPetitionService = (userId)=>{
    const url = `/consulting/${userId}/getConsultRecord`;
    return request.get(url);
}

//用户查询单个上访
export const getOnePetiotionService = (DataObj)=>{
    let userid = Data.userId;
    let petitionid = Data.petitionId;
    const url = `/consulting/${userid}/getConsultRecord/${petitionid}`;
    return request.get(url);
}

//用户网上信访
export const postOnePetitionService = (DataObj) =>{
    return request.post('/consulting/inLine',DataObj);
}

//用户查询信访状态
export const getOneStatusService = (petitionId)=>{
    let url = `/consulting/${petitionId}/getStatus`;
    return request.get(url);
}

//ai接口
export const aiTalkService = async(aiTalkParam)=>{
    const userId = aiTalkParam.userId;
    const question = aiTalkParam.question;
    let url = `/ai/send/${userId}`;
    return request.get(url,{"question":question});
}

//满意度调查
export const postRateService =(Data)=>{
   let url = `/consulting/postSatisfaction&petitionid=${Data.petitionId}&degree=${Data.degree}`;
   return request.post(url);
}